import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../layout/Home.vue'
import Dashboard from '../views/Dashboard/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home,
    redirect: '/dashboard',
    children: [
      {
        path: '/dashboard',
        component: Dashboard
      },
      {
        path: '/order',
        component: () =>
          import(/* webpackChunkName: "about" */ '../views/Order/index.vue')
      },
      {
        path: '/goods',
        component: () =>
          import(/* webpackChunkName: "about" */ '../views/Goods/index.vue'),
        redirect: '/goods/list',
        children: [
          {
            path: '/goods/list',
            component: () =>
              import(/* webpackChunkName: "about" */ '../views/Goods/list.vue')
          },
          {
            path: '/goods/add',
            component: () =>
              import(/* webpackChunkName: "about" */ '../views/Goods/add.vue')
          },
          {
            path: '/goods/cate',
            component: () =>
              import(/* webpackChunkName: "about" */ '../views/Goods/cate.vue')
          }
        ]
      },
      {
        path: '/shop',
        component: () =>
          import(/* webpackChunkName: "about" */ '../views/Shop/index.vue')
      },
      {
        path: '/account',
        component: () =>
          import(/* webpackChunkName: "about" */ '../views/Account/index.vue'),
        children: [
          {
            path: '/account/list',
            component: () =>
              import(
                /* webpackChunkName: "about" */ '../views/Account/list.vue'
              )
          },
          {
            path: '/account/add',
            component: () =>
              import(/* webpackChunkName: "about" */ '../views/Account/add.vue')
          },
          {
            path: '/account/reset',
            component: () =>
              import(
                /* webpackChunkName: "about" */ '../views/Account/reset.vue'
              )
          }
        ]
      },
      {
        path: '/total',
        component: () =>
          import(/* webpackChunkName: "about" */ '../views/Total/index.vue'),
        children: [
          {
            path: '/total/goods',
            component: () =>
              import(/* webpackChunkName: "about" */ '../views/Total/goods.vue')
          },
          {
            path: '/total/order',
            component: () =>
              import(/* webpackChunkName: "about" */ '../views/Total/order.vue')
          }
        ]
      }
    ]
  },
  {
    path: '/login',
    component: () =>
      import(/* webpackChunkName: "about" */ '../views/Login.vue')
  }
]

// component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')

const router = new VueRouter({
  routes
})

export default router
